@isTest
public class TaskTriggerTest {
    @isTest
    public static void createUpdateTaskTest() {
        Lead led = new Lead(LastName = 'Test Last', Phone = '1234567890', FirstName = 'Test First',Company = 'Test COmp', Status = 'Open - Not Contacted', Personal_Email__c = 'test@test.com',Country = 'Mexico');
        insert led;
        Account acc = new Account(Name = 'Test Account');
        insert acc;
        
        Task ts = new Task();
        ts.Description = 'Test Task';
        ts.Priority = 'Normal';
        ts.status = 'Not Started';
        ts.Subject = 'Test Subject';
        ts.type = 'Otheer';
        ts.State__c = 'sample';
        //ts.whoId = led.Id;
        ts.whatId = acc.Id;
        ts.activityDate = System.Date.today().addDays(Integer.valueOf(2));
        insert ts;
        Task ts1 = new Task();
        ts1.Description = 'Test Task1';
        ts1.Priority = 'Normal1';
        
        insert ts1;
          
        Account acc1 = new Account();
        acc1.Name='samplename';
        insert acc1;
        Lead led1= new Lead();
        led1.LastName ='sampleleadname';
        led1.FirstName ='Testname';
        led1.Phone = '2345678901';
        led1.Personal_Email__c = 'test1@test.com';
        led1.Country = 'Mexico';
        insert led1; 
        ts.whoId = led.Id;
        ts.whatId = null;
        ts.Status = 'Closed';
        update ts;
        
        try{
        
        delete ts;
        }
        Catch(Exception e)
        {}
    }
}